//
//  SDHSportsPlayerInfoCell.m
//  SDHSportsNews
//
//  Created by MichaelShan on 2021/3/12.
//

#import "SDHSportsPlayerInfoCell.h"
#import "SDHSportsPlayInfoDetailView.h"

const static CGFloat PlayInfoDetailViewWidth = 120;

@implementation SDHSportsPlayerInfoCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = UIColorFromRGB(40, 40, 40);
        [self initUI];
    }
    return self;
}

- (void)initUI {
    UIView *characteristicView = [UIView new];
    [self.contentView addSubview:characteristicView];
    [characteristicView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(10);
    }];
    
    UILabel *chTitle = [UILabel new];
    chTitle.textColor = [UIColor whiteColor];
    chTitle.font = [UIFont boldSystemFontOfSize:18];
    [characteristicView addSubview:chTitle];
    chTitle.text = @"Player characteristic";
    self.titleLb = chTitle;
    
    [chTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(25);
        make.left.mas_equalTo(10);
    }];
    
    UILabel *transferLabel = [UILabel new];
    transferLabel.hidden = YES;
    transferLabel.textColor = UIColorFromRGB(140, 140, 140);
    transferLabel.textAlignment = NSTextAlignmentLeft;
    transferLabel.font = [UIFont systemFontOfSize:16];
    transferLabel.numberOfLines = 0;
    [self.contentView addSubview:transferLabel];
    self.transferLb = transferLabel;
    transferLabel.text = @"2015-2016 \n 147488484 \n 2023-09-03 \n Manchester United \n Manchester United 18u\n";
    [transferLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(chTitle);
        make.top.equalTo(chTitle.mas_bottom).offset(10);
        make.right.mas_equalTo(-10);
        make.bottom.equalTo(self.contentView).offset(-5);
    }];

    SDHSportsPlayInfoDetailView *dView1 = [SDHSportsPlayInfoDetailView new];
    [self.contentView addSubview:dView1];
    self.infoView1 = dView1;
    
    [dView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(chTitle);
        make.top.equalTo(chTitle.mas_bottom).offset(10);
        make.width.mas_equalTo(PlayInfoDetailViewWidth);
    }];
    
    SDHSportsPlayInfoDetailView *dView2 = [SDHSportsPlayInfoDetailView new];
    [self.contentView addSubview:dView2];
    self.infoView2 = dView2;
    
    [dView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.equalTo(dView1);
        make.width.mas_equalTo(PlayInfoDetailViewWidth);
    }];
    
    SDHSportsPlayInfoDetailView *dView3 = [SDHSportsPlayInfoDetailView new];
    [self.contentView addSubview:dView3];
    self.infoView3 = dView3;
    
    [dView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.equalTo(dView1);
        make.width.mas_equalTo(PlayInfoDetailViewWidth);
    }];
}

@end

